package Gsb.Andro;

import static android.R.attr.label;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import java.util.List;
import modele.DAO;

public class MainActivity extends ListActivity {

    private List<String> lesDeps = DAO.getLesDeps();

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ImageView logo;
        logo = (ImageView) findViewById(R.id.imageView1);
        
        ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, lesDeps);
        setListAdapter(adapter);
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        //création d'une interface vers une autre activités 
        Intent inter = new Intent(this, ListeMedActivity.class);
        //preparation d'une donnée qui sera passée à l'autre
        inter.putExtra("leDep", lesDeps.get(position));
        //lancement de l'activity
        startActivity(inter);
    }
}
